import request from "@/utils/request";

enum API {
    GET_ALL_PERMISSTIOND = "/admin/acl/permission",
    ADD_PERMISSTION = "/admin/acl/permission/save",
    UPDATE_PERMISSTION = "/admin/acl/permission/update",
    DELETE_PERMISSTION_BYID = "/admin/acl/permission/remove/",
}

export const getAllPermisstion = () => request.get(API.GET_ALL_PERMISSTIOND);
export const addUpdatePermisstion = (premisstion:unknown) => {
    if(premisstion.id) return request.put(API.UPDATE_PERMISSTION,premisstion);
    return request.post(API.ADD_PERMISSTION,premisstion);
}
export const deletePermisstionById = (id:number) => request.delete(API.DELETE_PERMISSTION_BYID + id);

export default {
    getAllPermisstion,
    addUpdatePermisstion,
    deletePermisstionById
};